export default {
    namespaced: true,
    state: {
        isShowToast: false,
        toastMsg: "",
        //类型(success,danger,warning)
        toastType: ""
    },
    mutations: {
        changeIsShowToast(state, payload) {
            state.isShowToast = payload.show
            if (payload.show) {
                state.toastMsg = payload.msg
                state.toastType = payload.type
            }
        }
    },
    actions: {
        asyncIsShowToast(context, payload) {
            context.commit("changeIsShowToast", payload)
            setTimeout(() => {
                context.commit("changeIsShowToast", { show: false })
            }, 3000);
        }
    }
}